class Solution:
    def countKeyChanges(self, s: str) -> int:
        ans = 0
        for i, v in enumerate(s):
            if i > 0 and v.lower() != s[i - 1].lower():
                ans += 1
        return ans
